//
// Created by 王乐 on 2022/2/7.
//

#ifndef LESTE_LEPLAYERBEHAVIOUR_H
#define LESTE_LEPLAYERBEHAVIOUR_H

#include "LeBehaviour.h"

enum PlayerState
{
    STAND,
    WALK,
    JUMP,
    CLIMB,
    SPRINT
};

enum PlayerOrient
{
    PO_LEFT,
    PO_RIGHT
};

class LeSpriteRenderer;

class LePlayerBehaviour : public LeBehaviour
{
public:
    LePlayerBehaviour();
    virtual ~LePlayerBehaviour();

public:
    void Start() override;
    void Update() override;
    void FixedUpdate() override;
    void OnContactBegin(LeGameObject *other) override;
    void OnContactEnd(LeGameObject *other) override;

private:
    void processStand();
    void processWalk();
    void processJump();
    void processClimb();
    void processSprint();

private:
    PlayerState m_State;
    PlayerOrient m_Orient;
    unsigned int m_CurJumpNum;
    float m_WalkSpeed;
    float m_JumpSpeed;
    float m_SprintForce;
    float m_SprintTime;
    float m_CurSprintTime;
    float m_CurShadowTime;
    unsigned int m_CurSprintNum;
    PlayerState m_preSprintState;
    bool m_IsInAir;

    // Particles
    float m_EmitTime;
    float m_CurEmitTime;

    LeSpriteRenderer* m_pSpriteRenderer;

};


#endif //LESTE_LEPLAYERBEHAVIOUR_H
